package com.web.dao;

import com.web.entity.RMBRecord;
import org.apache.ibatis.annotations.*;

public interface RMBRecordMapper {
    @Delete({
        "delete from APP_RMB_RECORD",
        "where rmb_id = #{rmbId,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String rmbId);

    @Insert({
        "insert into APP_RMB_RECORD (rmb_id, pay_type, ",
        "body, type, money, ",
        "is_pay, user_id, to_user_id, ",
        "create_time, modify_time)",
        "values (#{rmbId,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ",
        "#{body,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{money,jdbcType=DECIMAL}, ",
        "#{isPay,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{toUserId,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})"
    })
    int insert(RMBRecord record);

    int insertSelective(RMBRecord record);

    @Select({
        "select",
        "rmb_id, pay_type, body, type, money, is_pay, user_id, to_user_id, create_time, ",
        "modify_time",
        "from APP_RMB_RECORD",
        "where rmb_id = #{rmbId,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    RMBRecord selectByPrimaryKey(String rmbId);

    int updateByPrimaryKeySelective(RMBRecord record);

    @Update({
        "update APP_RMB_RECORD",
        "set pay_type = #{payType,jdbcType=INTEGER},",
          "body = #{body,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "money = #{money,jdbcType=DECIMAL},",
          "is_pay = #{isPay,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=VARCHAR},",
          "to_user_id = #{toUserId,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP}",
        "where rmb_id = #{rmbId,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(RMBRecord record);

    RMBRecord selectById(@Param("key") String key,@Param("value") String value);
}